﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EFFC.Net.Returns;
using EFFC.Net.Interface;
using EFFC.Net.Parameters;

namespace EFFC.Net.WebBuilder.Parameters
{
    [Serializable]
    public class WebManageParameter : ParametersStd
    {
        public WebManageParameter()
        {
            AddPElement("PageModule", typeof(IModule));
            AddPElement("LoginUser");
            AddPElement("LoginUserID");
            AddPElement("AgentUser");
            AddPElement("AgentUserID");
            AddPElement("CurrentPage", typeof(int));
            AddPElement("GoToPage", typeof(int));
            AddPElement("PageSize", typeof(int));
            AddPElement("ActionID");
            AddPElement("FunctionID");
            AddPElement("IsOperatorLog", typeof(bool));

            SetValue("CurrentPage", 1);
            SetValue("GoToPage", 1);
            SetValue("IsOperatorLog", true);
            SetValue("GoToPage", -1);
            SetValue("OrderBy", "");
        }

        /// <summary>
        /// Page數據塊
        /// </summary>
        public IModule Module
        {
            get { return GetValue<IModule>("PageModule"); }
            set { _p["PageModule"].Value = value; }
        }
        /// <summary>
        /// 登錄用戶
        /// </summary>
        public string LoginUser
        {
            get { return GetValue<string>("LoginUser"); }
            set { _p["LoginUser"].Value = value; }
        }
        /// <summary>
        /// 登錄用戶ID
        /// </summary>
        public string LoginUserID
        {
            get { return GetValue<string>("LoginUserID"); }
            set { _p["LoginUserID"].Value = value; }
        }
        /// <summary>
        /// 代理用戶
        /// </summary>
        public string AgentUser
        {
            get { return GetValue<string>("AgentUser"); }
            set { _p["AgentUser"].Value = value; }
        }
        /// <summary>
        /// 代理用户ID
        /// </summary>
        public string AgentUserID
        {
            get { return GetValue<string>("AgentUserID"); }
            set { _p["AgentUserID"].Value = value; }
        }
        /// <summary>
        /// ActionID
        /// </summary>
        public string ActionID
        {
            get { return GetValue<string>("ActionID"); }
            set { _p["ActionID"].Value = value; }
        }
        /// <summary>
        /// ActionID
        /// </summary>
        public string FunctionID
        {
            get { return GetValue<string>("FunctionID"); }
            set { _p["FunctionID"].Value = value; }
        }

        /// <summary>
        /// 資料表排序欄位參數
        /// </summary>
        public string OrderBy
        {
            get { return GetValue<string>("OrderBy"); }
            set { _p["OrderBy"].Value = value; }
        }
        /// <summary>
        /// 翻頁會用到的參數，當前頁號
        /// </summary>
        public int CurrentPage
        {
            get { return GetValue<int>("CurrentPage"); }
            set { SetValue("CurrentPage", value); }
        }
        /// <summary>
        /// 翻頁會用到的參數，要翻到的頁號
        /// </summary>
        public int GoToPage
        {
            get { return GetValue<int>("GoToPage"); }
            set { SetValue("GoToPage", value); }
        }
        /// <summary>
        /// 每頁資料筆數
        /// </summary>
        public int PageSize
        {
            get { return GetValue<int>("PageSize"); }
            set { SetValue("PageSize", value); }
        }
        /// <summary>
        /// 是否要記錄操作log，默認開啟
        /// </summary>
        public bool IsOperatorLog
        {
            get { return GetValue<bool>("IsOperatorLog"); }
            set { SetValue("IsOperatorLog", value); }
        }
    }
}
